#include "vdsconfig.h"
#include "constants.h"
#include "datacenter.h"
#include "systempreset.h"

void VdsConfig::setParameter(int voltage, int pulseWidth, int pulseInterval)
{
    VdsParameterPtr vdsParameter = VdsParameterPtr(new VdsParameter);
    vdsParameter->testVolt = voltage;
    vdsParameter->pulseWidth = pulseWidth;
    vdsParameter->pulseInterval = pulseInterval;

    vdsParameter->probeRate[VoltageChannel] = SystemPreset::instance()->getIntData(EnumPresetItem::VoltageProbeRate); // ch1电压探头倍率
    vdsParameter->probeRate[CurrentChannel] = SystemPreset::instance()->getIntData(EnumPresetItem::CurrentProbeRate);   // ch2电流探头倍率
    vdsParameter->channelCoef[VoltageChannel] = SystemPreset::instance()->getDoubleData(EnumPresetItem::VoltageChannelCoef); // ch1转换系数
    vdsParameter->channelCoef[CurrentChannel] = SystemPreset::instance()->getDoubleData(EnumPresetItem::CurrentChannelCoef); // ch2电流转换系数
    vdsParameter->zeroPos[VoltageChannel] = SystemPreset::instance()->getDoubleData(EnumPresetItem::VoltageZeroPos); // ch1零点位置
    vdsParameter->zeroPos[CurrentChannel] = SystemPreset::instance()->getDoubleData(EnumPresetItem::CurrentZeroPos); // ch2零点位置
    emit DataCenter::instance()->setParameter(vdsParameter);
}
